<html>
<head><meta charset="utf-8"><title>mismatched types in libcore · t-compiler · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/index.html">t-compiler</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/mismatched.20types.20in.20libcore.html">mismatched types in libcore</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="186514271"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/mismatched%20types%20in%20libcore/near/186514271" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matthiaskrgr <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/mismatched.20types.20in.20libcore.html#186514271">(Jan 24 2020 at 17:34)</a>:</h4>
<p>Hi, any ideas why <code>./x.py check</code>  works but <code>./x.py clippy</code> errors while checking libcore:</p>
<div class="codehilite"><pre><span></span>error[E0308]: mismatched types
   --&gt; src/libcore/macros/mod.rs:418:49
    |
417 | /  macro_rules! write {
418 | |      ($dst:expr, $($arg:tt)*) =&gt; ($dst.write_fmt($crate::format_args!($($arg)*)))
    | |                                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    | |                                                  |
    | |                                                  expected enum `fmt::rt::v1::Position`, found `usize`
    | |                                                  help: try using a variant of the expected enum: `fmt::rt::v1::Position::At($crate::format_args!($($arg)*))`
    | |                                                  in this macro invocation (#3)
419 | |  }
    | |__- in this expansion of `write!` (#2)
...
792 | /      macro_rules! format_args {
793 | |          ($fmt:expr) =&gt; {{ /* compiler built-in */ }};
794 | |          ($fmt:expr, $($args:tt)*) =&gt; {{ /* compiler built-in */ }};
795 | |      }
    | |______- in this expansion of `$crate::format_args!` (#3)
    |
   ::: src/libcore/num/bignum.rs:100:1
    |
100 |  / macro_rules! define_bignum {
101 |  |     ($name:ident: type=$ty:ty, n=$n:expr) =&gt; {
102 |  |         /// Stack-allocated arbitrary-precision (up to certain limit) integer.
103 |  |         ///
...    |
470 |  |                 write!(f, &quot;{:#x}&quot;, self.base[sz - 1])?;
    |  |                 ------------------------------------- in this macro invocation (#2)
...    |
477 |  |     };
478 |  | }
    |  |_- in this expansion of `define_bignum!` (#1)
...
483 |    define_bignum!(Big32x40: type=Digit32, n=40);
    |    --------------------------------------------- in this macro invocation (#1)
</pre></div>



<a name="186519356"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/mismatched%20types%20in%20libcore/near/186519356" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/mismatched.20types.20in.20libcore.html#186519356">(Jan 24 2020 at 18:25)</a>:</h4>
<p>you need to use a beta clippy and pass <code>--cfg=bootstrap</code></p>



<a name="186519362"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/mismatched%20types%20in%20libcore/near/186519362" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/mismatched.20types.20in.20libcore.html#186519362">(Jan 24 2020 at 18:25)</a>:</h4>
<p>there was some discussion in Discord I believe</p>



<a name="186544384"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/mismatched%20types%20in%20libcore/near/186544384" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matthiaskrgr <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/mismatched.20types.20in.20libcore.html#186544384">(Jan 24 2020 at 23:24)</a>:</h4>
<p>right, so I can set my default clippy to beta but then the beta-clippy will choke on features that were stabilized on features that were enabled on nightly only<br>
<code>RUSTC_BOOTSTRAP=1 RUSTFLAGS="--cfg=bootstrap" RUST_BACKTRACE=full  ./x.py clippy</code></p>
<div class="codehilite"><pre><span></span>error[E0658]: use of unstable library feature &#39;matches_macro&#39;
   --&gt; src/librustc_span/lib.rs:313:9
    |
313 |         matches!(self.ctxt().outer_expn_data().kind, ExpnKind::Macro(MacroKind::Derive, _))
    |         ^^^^^^^
    |
    = note: for more information, see https://github.com/rust-lang/rust/issues/65721
    = help: add `#![feature(matches_macro)]` to the crate attributes to enable
</pre></div>



<a name="186544876"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/mismatched%20types%20in%20libcore/near/186544876" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/mismatched.20types.20in.20libcore.html#186544876">(Jan 24 2020 at 23:31)</a>:</h4>
<p>oh... yea, so it seems like <code>x.py clippy</code> runs with the beta libstd, but it should be using the just-built libstd</p>



<a name="186544988"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/mismatched%20types%20in%20libcore/near/186544988" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/mismatched.20types.20in.20libcore.html#186544988">(Jan 24 2020 at 23:32)</a>:</h4>
<p>I'm not sure what <code>x.py clippy</code> is doing differntly from <code>x.py check</code>, but it using the downloaded libstd instead of the built libstd would give exactly this kind of problem</p>



<a name="186545037"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/mismatched%20types%20in%20libcore/near/186545037" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/mismatched.20types.20in.20libcore.html#186545037">(Jan 24 2020 at 23:33)</a>:</h4>
<p>I don't have time to fix x.py clippy I'm afraid nor to really help out much -- even review will be a stretch</p>



<a name="186545047"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/mismatched%20types%20in%20libcore/near/186545047" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/mismatched.20types.20in.20libcore.html#186545047">(Jan 24 2020 at 23:33)</a>:</h4>
<p>otoh, if it only affects clippy, I'm happy to just merge things in without too close of review</p>



<a name="186565330"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/mismatched%20types%20in%20libcore/near/186565330" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matthiaskrgr <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/mismatched.20types.20in.20libcore.html#186565330">(Jan 25 2020 at 09:18)</a>:</h4>
<p>I tried again with the beta clippy and the bootstrap compiler being the same version now but that didn't help, I still get <code> use of unstable library feature</code> :/</p>



<a name="186566151"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/mismatched%20types%20in%20libcore/near/186566151" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/mismatched.20types.20in.20libcore.html#186566151">(Jan 25 2020 at 09:44)</a>:</h4>
<p>I don't think you're going to get around fixing x.py to actually give clippy the freshly built libstd</p>



<a name="186566218"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/mismatched%20types%20in%20libcore/near/186566218" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/mismatched.20types.20in.20libcore.html#186566218">(Jan 25 2020 at 09:46)</a>:</h4>
<p>Although it may be possible to set the sysroot env vars to the correct libstd without touching x.py. check the clippy driver source code for that swash of env vars that allow you to manipulate the sysroot.</p>



<a name="186644334"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/mismatched%20types%20in%20libcore/near/186644334" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matthiaskrgr <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/mismatched.20types.20in.20libcore.html#186644334">(Jan 27 2020 at 00:12)</a>:</h4>
<p>I wonder if something like <code>RUSTFLAGS="--cap-lints warn"  RUSTC_WRAPPER="stage2-clippy-driver" ./x.py check</code> could actually work. but it seems I can't simply override the output/target dir mh</p>



<a name="186646629"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/mismatched%20types%20in%20libcore/near/186646629" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/mismatched.20types.20in.20libcore.html#186646629">(Jan 27 2020 at 01:28)</a>:</h4>
<p>rustc-wrapper is not going to work well with how we do things in rustbuild</p>



<a name="186646631"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/mismatched%20types%20in%20libcore/near/186646631" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/mismatched.20types.20in.20libcore.html#186646631">(Jan 27 2020 at 01:28)</a>:</h4>
<p>or at least, I suspect it wouldn't</p>



<a name="186670470"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/mismatched%20types%20in%20libcore/near/186670470" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matthiaskrgr <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/mismatched.20types.20in.20libcore.html#186670470">(Jan 27 2020 at 10:44)</a>:</h4>
<p>Hm, I've been using RUSTC_WRAPPER=sccache to successfully bootstrap rustc</p>



<a name="186693640"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/mismatched%20types%20in%20libcore/near/186693640" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/mismatched.20types.20in.20libcore.html#186693640">(Jan 27 2020 at 15:40)</a>:</h4>
<p>it might work in theory but I think it may fail in unexpected ways (e.g. cache too much)</p>



<a name="186693658"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/mismatched%20types%20in%20libcore/near/186693658" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/mismatched.20types.20in.20libcore.html#186693658">(Jan 27 2020 at 15:40)</a>:</h4>
<p>since I believe sccache won't know that we're switching compilers under the hood</p>



<a name="187116336"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/mismatched%20types%20in%20libcore/near/187116336" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matthiaskrgr <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/mismatched.20types.20in.20libcore.html#187116336">(Jan 31 2020 at 19:40)</a>:</h4>
<p>looks like the problem was --cfg=bootstrap at last.....</p>



<a name="187116653"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/mismatched%20types%20in%20libcore/near/187116653" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matthiaskrgr <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/mismatched.20types.20in.20libcore.html#187116653">(Jan 31 2020 at 19:43)</a>:</h4>
<p>I found out after accidentally reading <a href="https://github.com/rust-lang/rust/pull/68708/files#diff-4d152d5bfb85f6d41ee9a8a7988c1064" target="_blank" title="https://github.com/rust-lang/rust/pull/68708/files#diff-4d152d5bfb85f6d41ee9a8a7988c1064">https://github.com/rust-lang/rust/pull/68708/files#diff-4d152d5bfb85f6d41ee9a8a7988c1064</a> , heh</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>